#!/usr/bin/env python3

import pyshowip

ipFile = pyshowip.ShowIP()
ipFile.open("./QQWry.Dat")
print(ipFile.idx_start)
print(ipFile.idx_end)
print(ipFile.readLong4(ipFile.idx_start)+7)
print(ipFile.readLong3(ipFile.idx_start+11))

offset = ipFile.searchIPIndex(1000011024)
print(offset)
print(ipFile.IP2int('192.168.20.29'))
result = ipFile.readRecord(offset[0])
print(result[0])
print(result[1])
print(result[2])

offset = ipFile.searchIPIndex(ipFile.IP2int('115.27.63.82'))
print(offset)
print(ipFile.IP2int('192.168.20.29'))
result = ipFile.readRecord(offset[0])
print(result[0])
print(result[1])
print(result[2])

offset = ipFile.searchIPIndex(ipFile.IP2int('192.168.20.29'))
print(offset)
print(ipFile.showIP('192.168.20.29'))
print(ipFile.showIP('115.27.63.82'))
print(ipFile.showIP('255.255.255.255'))
print(ipFile.showIP('0.0.0.0'))
